package com.eastfair.venueservice.enumeration;

import com.eastfair.annotation.base.BaseEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

import java.util.stream.Stream;

/**
 * <p>
 * 实体注释中生成的类型枚举
 * 服务订单
 * </p>
 *
 * @author dq
 * @date 2022-09-28
 */
@Getter
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "ServiceOrderPayStatusEnum", description = "支付状态 #{NOT_PAY:未付款;HAS_PAY:已付款;PARTIAL_PAY:部分付款-枚举")
public enum WorkOvertimePayStatusEnum implements BaseEnum {

    /**
     * NOT_PAY="未付款"
     */
    NOT_PAY("未付款"),
    /**
     * HAS_PAY="已付款"
     */
    HAS_PAY("已付款"),
    /**
     * PARTIAL_PAY="部分付款"
     */
    PARTIAL_PAY("部分付款"),
    ;

    @ApiModelProperty(value = "描述")
    private String desc;


    /**
     * 根据当前枚举的name匹配
     */
    public static WorkOvertimePayStatusEnum match(String val, WorkOvertimePayStatusEnum def) {
        return Stream.of(values()).parallel().filter(item -> item.name().equalsIgnoreCase(val)).findAny().orElse(def);
    }

    public static WorkOvertimePayStatusEnum get(String val) {
        return match(val, null);
    }

    public boolean eq(WorkOvertimePayStatusEnum val) {
        return val != null && eq(val.name());
    }

    @Override
    @ApiModelProperty(value = "编码", allowableValues = "NOT_PAY,HAS_PAY,PARTIAL_PAY", example = "NOT_PAY")
    public String getCode() {
        return this.name();
    }

}
